package org.aeon.gamechatnest.pojo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Null;
import lombok.Data;
import org.aeon.gamechatnest.validated.Add;
import org.aeon.gamechatnest.validated.Update;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author liys 2024年5月13日
 * 加入服务器的服务器成员表
 * @TableName server_members
 */
@Data
@Schema(description = "服务器成员实体", name = "ServerMembers")
public class ServerMembers implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * 服务器id
     */
    @Schema(description = "服务器id", name = "serverId")
    @TableId
    private Long serverId;

    /**
     * 用户id
     */
    @Schema(description = "用户id", name = "userId")
    private Long userId;

    /**
     * 服务器下用户的备注名
     */
    @Schema(description = "服务器下用户的备注名", name = "noteName")
    @NotBlank(groups = Update.class, message = "服务器下用户的备注名不能为空")
    private String noteName;

    /**
     * 加入时间
     */
    @Schema(description = "加入时间", name = "joinTime")
    @Null(groups = {Add.class, Update.class}, message = "加入时间应该为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date joinTime;

}
